#pragma once
#include "ZuiLib.h"
#include "LRefObject.h"

namespace ZuiLib {

class LText :public LRefObject<ZText>
{
public:

	int getTextStyle(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetTextStyle());
	}

	int setTextStyle(LuaFuncState& L)
	{
		pThis->SetTextStyle(L.arg(0).toUInt());
		return 0;
	}

	int getTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetTextColor());
	}

	int SetTextColor(LuaFuncState& L)
	{
		pThis->SetTextColor(toColor(L.arg(0)));
		return 0;
	}

	int getDisabledTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetDisabledTextColor());
	}

	int setDisabledTextColor(LuaFuncState& L)
	{
		pThis->SetDisabledTextColor(toColor(L.arg(0)));
		return 0;
	}

	int setFontName(LuaFuncState& L)
	{
		pThis->SetFontName(L.arg(0).toString());
		return 0;
	}

	int getFontName(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetFontName());
	}

	int getTextPadding(LuaFuncState& L)
	{
		return L.lreturn(toLua(&L, pThis->GetTextPadding()));
	}

	int setTextPadding(LuaFuncState& L)
	{
		pThis->SetTextPadding(toRect(L.arg(0)));
		return 0;
	}

	int getMaxLine(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetMaxLine());
	}

	int setMaxLine(LuaFuncState& L)
	{
		pThis->SetMaxLine(L.arg(0).toInt());
		return 0;
	}

	int isAutoHeight(LuaFuncState& L)
	{
		return L.lreturn(pThis->IsAutoHeight());
	}

	int setAutoHeight(LuaFuncState& L)
	{
		pThis->SetAutoHeight(L.arg(0).toBool());
		return 0;
	}


	BEGIN_MAP_FUNC(LText)
	DECLARE_FUNC(getTextStyle),
	DECLARE_FUNC(setTextStyle),
	DECLARE_FUNC(getTextColor),
	DECLARE_FUNC(SetTextColor),
	DECLARE_FUNC(getDisabledTextColor),
	DECLARE_FUNC(setDisabledTextColor),
	DECLARE_FUNC(setFontName),
	DECLARE_FUNC(getFontName),
	DECLARE_FUNC(getTextPadding),
	DECLARE_FUNC(setTextPadding),

	DECLARE_FUNC(getMaxLine),
	DECLARE_FUNC(setMaxLine),
	DECLARE_FUNC(isAutoHeight),
	DECLARE_FUNC(setAutoHeight),
	END_MAP_FUNC
};

}//namespace
